--creating the StudentType2 Hierarchy
create or replace type UndergraduateType2 UNDER StudentType2(
	major	varchar2(15))
instantiable
not final;


create or replace type freshmantype2 UNDER UndergraduateType2(
peerMentor	varchar2(25))
instantiable
final;

-- entering all subtypes of Student2 in the same table
INSERT INTO Student2 VALUES
(StudentType2('S444','Klein','Susan', AddressType('123 Hudson Street','New York','NY','10001'),(SELECT REF(f) FROM Faculty2 f WHERE facId = 'F101'),36, '14-Mar-1976'));

INSERT INTO Student2 VALUES (UndergraduateType2('S666','Logan','Randolph', null, null, 12,'23-May-1982','Spanish'));

INSERT INTO Student2 VALUES
(FreshmanType2('S777','Miller','Terrence',AddressType('999 Salmon Street','Sitka','AK','99835'),(SELECT REF(f)FROM Faculty2 f WHERE facId = 'F101'),30,'30-Jun-1985', 'Math','Tom Smith'));

